<library xmlns="http://www.w3.org/1999/xhtml"
  xmlns:py="http://genshi.edgewall.org/"
  xmlns:xi="http://www.w3.org/2001/XInclude"
  py:strip="True"
>
  <py:match path="head">
    <!-- Add the Dojo CSS -->
    <link rel="stylesheet" type="text/css" href="/static/dojo/dojo/resources/dojo.css"/>
    <link rel="stylesheet" type="text/css" href="/static/dojo/dijit/themes/tundra/tundra.css"/>
    <link py:for="req in C.css_requires()"
      rel="stylesheet" type="text/css" href="req"/>
    <!-- Add the Dojo bootstrap code -->
    <script 
      djConfig="parseOnLoad:true"
      type="text/javascript"
      src="/static/dojo/dojo/dojo.js">
    </script>
    <!-- Require all the resources requested by topes -->
    <script type="text/javascript">
      <py:for each="req in C.dojo_requires()">dojo.require('$req');
      </py:for>
    </script>
    <!-- Add the dojo onload code -->
    <script type="text/javascript">
      <py:for each="fun in C.dojo_onload()">
        dojo.addOnLoad(function(){$fun});
      </py:for>
    </script>
    <!-- Insert the hold <head> -->
    ${select("*|text()")}
  </py:match>
</library>
